package com.che.software.testato.domain.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.che.software.testato.domain.entity.creation.ScriptCreation;

/**
 * Class representing an arrow in the map diagrams.
 * 
 * @author Clement HELIOU (clement.heliou@che-software.com).
 * @copyright Che Software.
 * @license GNU General Public License.
 * @see Serializable
 * @since July, 2011.
 * 
 *        This file is part of Testato.
 * 
 *        Testato is free software: you can redistribute it and/or modify it
 *        under the terms of the GNU General Public License as published by the
 *        Free Software Foundation, either version 3 of the License, or (at your
 *        option) any later version.
 * 
 *        Testato is distributed in the hope that it will be useful, but WITHOUT
 *        ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 *        FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
 *        for more details.
 * 
 *        You should have received a copy of the GNU General Public License
 *        along with Testato. If not, see <http://www.gnu.org/licenses/>.
 * 
 *        Testato's logo is a creation of Arrioch
 *        (http://arrioch.deviantart.com/) and it's distributed under the terms
 *        of the Creative Commons License.
 */
public class MapArrow implements Serializable {

	/**
	 * Constants.
	 */
	private static final long serialVersionUID = 9156947460261445301L;

	/**
	 * Members.
	 */
	private boolean operationalized, refined;
	private Integer actionPlanId, maxIterationNumber, testCaseId;
	private List<ScriptCreation> scripts;
	private List<Variant> variants;
	private String label, sourceLabel, targetLabel;

	/**
	 * Builder from label.
	 * 
	 * @param label the edge label.
	 */
	public MapArrow(String label) {
		this(false, false, label, 0, null, null, null, null);
	}

	/**
	 * Builder from fields.
	 * 
	 * @param operationalized does the arrow has been operationalized?
	 * @param refined does the arrow has been refined?
	 * @param label the arrow label.
	 * @param maxIterationNumber the max iteration number for the arrow.
	 * @param testCaseId the test case associated to the arrow.
	 * @param actionPlanId the action plan associated to the arrow.
	 * @param sourceLabel the label of the source intention.
	 * @param targetLabel the label of the target intention.
	 */
	public MapArrow(boolean operationalized, boolean refined, String label, Integer maxIterationNumber, Integer testCaseId, Integer actionPlanId, String sourceLabel, String targetLabel) {
		super();
		this.operationalized = operationalized;
		this.refined = refined;
		this.label = label;
		this.maxIterationNumber = maxIterationNumber;
		this.scripts = new ArrayList<ScriptCreation>();
		this.variants = new ArrayList<Variant>();
		this.testCaseId = testCaseId;
		this.actionPlanId = actionPlanId;
		this.sourceLabel = sourceLabel;
		this.targetLabel = targetLabel;
	}

	/**
	 * Getter for the private field value operationalized.
	 * 
	 * @return the operationalized field value.
	 */
	public boolean isOperationalized() {
		return operationalized;
	}

	/**
	 * Setting a value to the operationalized field.
	 * 
	 * @param operationalized the value to set.
	 */
	public void setOperationalized(boolean operationalized) {
		this.operationalized = operationalized;
	}

	/**
	 * Getter for the private field value refined.
	 * 
	 * @return the refined field value.
	 */
	public boolean isRefined() {
		return refined;
	}

	/**
	 * Setting a value to the refined field.
	 * 
	 * @param refined the value to set.
	 */
	public void setRefined(boolean refined) {
		this.refined = refined;
	}

	/**
	 * Getter for the private field value label.
	 * 
	 * @return the label field value.
	 */
	public String getLabel() {
		return label;
	}

	/**
	 * Setting a value to the label field.
	 * 
	 * @param label the value to set.
	 */
	public void setLabel(String label) {
		this.label = label;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return label;
	}

	/**
	 * Getter for the private field value maxIterationNumber.
	 * 
	 * @return the maxIterationNumber field value.
	 */
	public Integer getMaxIterationNumber() {
		return maxIterationNumber;
	}

	/**
	 * Setting a value to the maxIterationNumber field.
	 * 
	 * @param maxIterationNumber the value to set.
	 */
	public void setMaxIterationNumber(Integer maxIterationNumber) {
		this.maxIterationNumber = maxIterationNumber;
	}

	/**
	 * Getter for the private field value variants.
	 * 
	 * @return the variants field value.
	 */
	public List<Variant> getVariants() {
		return variants;
	}

	/**
	 * Setting a value to the variants field.
	 * 
	 * @param variants the value to set.
	 */
	public void setVariants(List<Variant> variants) {
		this.variants = variants;
	}

	/**
	 * Getter for the private field value scripts.
	 * 
	 * @return the scripts field value.
	 */
	public List<ScriptCreation> getScripts() {
		return scripts;
	}

	/**
	 * Setting a value to the scripts field.
	 * 
	 * @param scripts the value to set.
	 */
	public void setScripts(List<ScriptCreation> scripts) {
		this.scripts = scripts;
	}

	/**
	 * Getter for the private field value testCaseId.
	 * 
	 * @return the testCaseId field value.
	 */
	public Integer getTestCaseId() {
		return testCaseId;
	}

	/**
	 * Setting a value to the testCaseId field.
	 * 
	 * @param testCaseId the value to set.
	 */
	public void setTestCaseId(Integer testCaseId) {
		this.testCaseId = testCaseId;
	}

	/**
	 * Getter for the private field value actionPlanId.
	 * 
	 * @return the actionPlanId field value.
	 */
	public Integer getActionPlanId() {
		return actionPlanId;
	}

	/**
	 * Setting a value to the actionPlanId field.
	 * 
	 * @param actionPlanId the value to set.
	 */
	public void setActionPlanId(Integer actionPlanId) {
		this.actionPlanId = actionPlanId;
	}

	/**
	 * Getter for the private field value sourceLabel.
	 * 
	 * @return the sourceLabel field value.
	 */
	public String getSourceLabel() {
		return sourceLabel;
	}

	/**
	 * Setting a value to the sourceLabel field.
	 * 
	 * @param sourceLabel the value to set.
	 */
	public void setSourceLabel(String sourceLabel) {
		this.sourceLabel = sourceLabel;
	}

	/**
	 * Getter for the private field value targetLabel.
	 * 
	 * @return the targetLabel field value.
	 */
	public String getTargetLabel() {
		return targetLabel;
	}

	/**
	 * Setting a value to the targetLabel field.
	 * 
	 * @param targetLabel the value to set.
	 */
	public void setTargetLabel(String targetLabel) {
		this.targetLabel = targetLabel;
	}
}